<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    .parent {
      display: flex;
      flex-direction: column;
      border: 2px solid black;
    }

    .child {
      border: 2px solid blue;
      flex: 0 0 auto; /* 这行代码告诉子盒子不要随着父盒子的大小变化 */
    }
  </style>
</head>
<body>
  <div class="parent">
    <div class="child" style="flex-grow: 0;">上面的盒子<br>上面的盒子<br>上面的盒子</div>
    <div class="child">下面的盒子<br>下面的盒子</div>
  </div>
</body>
</html>
